package core

import (
	"gin-admin/common/dto/response"
	"gin-admin/global"

	"github.com/gin-gonic/gin"
)

func ValidateParams(ctx *gin.Context, obj interface{}) bool {
	if err := ctx.ShouldBind(obj); err != nil {
		global.GA_LOGGER.Sugar().Errorw("参数校验失败", "error", err)
		response.FailedWithCode(ctx, response.SystemParameterErrorCode)
		return false
	}
	return true
}
